import { GTextFormat } from "../../../common/GTextFormat";
import { ObjCreate } from "../common/ObjCreate";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { EQuestionFuncCode } from "../../../../Message/Public/EQuestionFuncCode";
import { Language } from "../../../../extend/language/Language";
import { GLoadedButton } from "../../../../com/mui/controls/GLoadedButton";
type int = number;
//class FunctionButton
    
    export  class FunctionButton /* flash.display.Sprite */
    {
        constructor(arg1: string, arg2: int, arg3: int, arg4: string)
        {
            
            this.init(arg1, arg2, arg3, arg4);
            return;
        }

        /* internal  */init(arg1: string, arg2: int, arg3: int, arg4: string): void
        {
            this._whiteTf = new GTextFormat("", 12, 16777215);
            this._yellowTf = new GTextFormat("", 12, 16763955);
            this._btn = ObjCreate.createGLoadedButton(arg4, 0, 0, arg2, arg3, this);
            this._btn.addEventListener(flash.events.MouseEvent.CLICK, this.onMouseClickHandler);
            this._vip = ObjCreate.createGLoadedButton("QuesVip", 40, 48, 30, 12, this);
            this._vip.useHandCursor = false;
            this._useNumTxt = ObjCreate.createTextField("", 15, 43, 30, 20, this, this._whiteTf);
            this._vipNumTxt = ObjCreate.createTextField("", 75, 43, 40, 20, this, this._yellowTf);
            return;
        }

        /* internal  */onMouseClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FuncCodeChange, this._funcCode));
            return;
        }

        public updateFunctionNum(arg1: int, arg2: int, arg3: int): void
        {
            this._useNumTxt.text = arg1 + "/" + arg2;
            this._useNumTxt.setTextFormat(this._whiteTf);
            this._vipNumTxt.text = "（+" + arg3 + "）";
            this._vipNumTxt.setTextFormat(this._yellowTf);
            return;
        }

        public set funcCode(arg1: int)
        {
            this._funcCode = arg1;
            this.setVipTips();
            return;
        }

        public get funcCode(): int
        {
            return this._funcCode;
        }

        public set buttonEnable(arg1: Boolean)
        {
            this._btn.enabled = arg1;
            return;
        }

        public set toolTip(arg1: string)
        {
            this._btn.toolTipData = arg1;
            return;
        }

        /* internal  */setVipTips(): void
        {
            var loc1="<font color=\'#b1efff\'>";
            if (this.funcCode != EQuestionFuncCode._EQuestionFuncCodeRight) 
            {
                if (this.funcCode != EQuestionFuncCode._EQuestionFuncCodeRemainTwo) 
                {
                    if (this.funcCode == EQuestionFuncCode._EQuestionFuncCodeDouble) 
                    {
                        loc1 = loc1 + Language.getString(35627);
                    }
                }
                else 
                {
                    loc1 = loc1 + Language.getString(35626);
                }
            }
            else 
            {
                loc1 = loc1 + Language.getString(35625);
            }
            loc1 = loc1 + "</font>";
            this._vip.toolTipData = loc1;
            return;
        }

        /* internal */ /* var */_useNumTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_vipNumTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_whiteTf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_yellowTf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_funcCode: int;

        /* internal */ /* var */_btn: GLoadedButton;

        /* internal */ /* var */_vip: GLoadedButton;
    }
